package com.ruoyi.common.enums;

import com.ruoyi.common.constant.DeptNameConstants;

/**
 * 企业类型
 * 
 * @author lgq
 */
public enum DeptType
{
    PLATFORM(DeptNameConstants.DEPT_NAME_PLATFORM,100L),PERSONAL_USER(DeptNameConstants.ROLE_NAME_PERSONAL,101L),COMPANY_USER(DeptNameConstants.ROLE_NAME_COMPANY,102L);

    private String deptType;
    private Long deptId;

    DeptType(String deptType, Long deptId) {
        this.deptType = deptType;
        this.deptId = deptId;
    }

    public String getDeptType() {
        return deptType;
    }

    public void setDeptType(String deptType) {
        this.deptType = deptType;
    }

    public Long getDeptId() {
        return deptId;
    }

    public void setDeptId(Long deptId) {
        this.deptId = deptId;
    }

    public static Long getIdByType(String deptType){
        DeptType[] deptTypeEnums = values();
        for (int i = 0; i < deptTypeEnums.length; i++) {
            DeptType deptTypeEnum = deptTypeEnums[i];
            if (deptTypeEnum.getDeptType().equals(deptType)) {
                return deptTypeEnum.getDeptId();
            }
        }
        return null;
    }
}
